import React from 'react';

export default class UserAdd extends React.Component {
    constructor(props){
        super(props);
        this.nameInput = React.createRef();
    }

    handleSubmit = (e) => {
        e.preventDefault();
        console.log(this.nameInput.current.value);
        this.props.history.push('/user/list');
    }
    render() {
        console.log(this.props);
        return (
            <div>
                <form onSubmit={this.handleSubmit}>
                    <input ref={this.nameInput} name={"name"} placeholder={"请输入姓名"} type={"text"}/>
                    <button type={"submit"}>提交</button>
                </form>
            </div>
        )
    }
}